/*
 * Copyright (c) 2006, 2022, webrx.cn All rights reserved.
 *
 */
package cn.webrx;

import java.util.Date;

/**
 * <p>Project: jse2204 - Str2
 * <p>Powered by webrx On 2022-09-13 15:36:45
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class Str2 {
    public static void main(String[] args) {
        //java.lang.String final类，不可能被继承

        String s = "hello中国人";
        //.length() 方法 返回字符个数
        System.out.println(s.length());


        //1byte 1字节
        //1MB 1024b
        //1GB 1024MB
        //1TB 1024GB  1PB 1024TB
        //2TB 64

        //1000MB 1G 1024MB 1G


        //.toCharArray() 返回char[]数组
        char[] chars = s.toCharArray();

        //.getBytes() 返回byte[] 数组
        byte[] bytes = s.getBytes();

        //获取字符串占用的字节数(14字节)
        System.out.println(s.getBytes().length);


    }
}
